package com.xjh.basestudy.designmode.behaviorMode.behaviorMode9_Visitor.p2_batch;

import com.xjh.basestudy.designmode.behaviorMode.behaviorMode9_Visitor.p2_batch.Product;
import com.xjh.basestudy.designmode.behaviorMode.behaviorMode9_Visitor.p2_batch.Visitor;

import java.time.LocalDate;

/**
 * @Author XuJianHua
 * @Date 2022/10/5 21:19
 * @Description 水果类：由于计价不固定，有单独属性weight

 */
public class Fruit extends Product implements Acceptable{

    private float weight;

    public Fruit(String name, LocalDate producedDate, float price, float weight) {
        super(name, producedDate, price);
        this.weight = weight;
    }

    public float getWeight() {
        return weight;
    }

    public void setWeight(float weight) {
        this.weight = weight;
    }

    @Override
    public void accept(Visitor visitor) {
        visitor.visit(this);// 把自己交给访问者
    }

}